<template>
  <div class="educationadd">
    <div class="educationaddchild">
      <div class="educationaddchildcont">
        <p class="educationaddlift">工作职责</p>
      </div>
      <van-divider color="#E8E8E8" />

      <div>
        <van-form @submit="onSubmit">
          <van-field class="textareaedut" v-model="message" rows="6" autosize type="textarea" maxlength="500"
            show-word-limit placeholder="请输入工作职责" :rules="[{ required: true, message: ' ' },
            { validator}]" />
          <van-divider color="#E8E8E8" />
          <div style="margin: 16px;">
            <van-button round block type="info" native-type="submit">保存</van-button>
          </div>
        </van-form>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      schoolname: '',
      message: '',
      namecode: ''
    }
  },
  computed: {},
  methods: {
    // 信息提交到父级页面
    onSubmit () {
      let that = this
      // 钓调用父级函数
      that.$emit('industryca', this.namecode, this.message)
    },
    // 判断是否全为空格
    validator () {
      console.log(this.message.trim().length, 's')
      if (this.message.trim().length === 0) {
        this.message = ''
      }
    },
    // 获取父页面传递归来的数据
    substate (namecode, name) {
      console.log(name)
      this.namecode = namecode
      this.schoolname = name
      this.message = name
      this.$forceUpdate()
    }
  },
  created () { }
}
</script>
<style scoped></style>
